<?php echo $this->Html->script('Medico'); ?>
<div id="msg"></div>
<fieldset>
    <legend>Médicos</legend>    
    <input type="hidden" name="_method" value="POST"/>
    <table width="98%" border="0" cellspacing="0" cellpadding="2">
        <thead>
            <th colspan="3">
                <b>INFORMAÇÕES BÁSICAS</b>
            </th>
            <th style="text-align: right;">
                <img src="/siscel/img/bt_apagar.gif" id="" onclick="Medico.excluiMedico('<?php echo h($dados['MEDICO']['CPF_MEDIC']); ?>',true);"/>
                <img src="/siscel/img/bt_lapis.gif" id="" onclick="Medico.redireciona('<?php echo h($dados['MEDICO']['CPF_MEDIC']); ?>');"/>
            </th>
        </thead>
        <tr>
            <td rowspan="4">
                <div>
                    <?php

                    if (!empty($dados['MEDICO']['IM_FOTO'])) :
                        echo $this->Siscel->foto($dados['MEDICO']['IM_FOTO']);
                    else:
                        echo $this->Html->image('/img/perfil.jpg', array('width' => '100', 'heigth' => '133', 'label' => null));
                    endif;
                    ?>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <?php echo $this->Form->input('USUARIO.NM_AUT', array('type' => 'text', 'label' => 'Nome', 'id' => 'txtNome', 'class' => 'campoAlfa', 'size' => "30", 'maxlength' => "120", 'value' => h($dados['MEDICO']['NM_MEDIC']), 'readonly'=>'readonly' )); ?>
            </td>
            <td>
                <?php echo $this->Form->input('USUARIO.DT_NASC', array('type' => 'text', 'label' => 'Nascimento', 'id' => 'txtDTNASC', 'class' => '', 'size' => "20", 'maxlength' => "14", 'value' => ( !empty($dados['MEDICO']['DT_NASC']) ? h(date('d/m/Y',strtotime($dados['MEDICO']['DT_NASC']))) : '' ), 'readonly'=>'readonly')); ?>
            </td>            
        </tr>
        <tr>
            <td>
                <?php echo $this->Form->input('MEDICOS.CD_CRM', array('type' => 'text', 'label' => 'CRM', 'id' => 'txtCDCRM', 'class' => 'campoNumerico', 'size' => "10", 'maxlength' => "9", 'value' => h($dados['MEDICO']['CD_CRM'].' '.$dados['UF']['NM_UF']), 'readonly'=>'readonly')); ?>
            </td>
            <td>
                <?php echo $this->Form->input('MEDICOS.CPF_MEDIC', array('type' => 'text', 'label' => 'CPF', 'id' => 'txtCDLOGIN', 'class' => 'campoCPF', 'size' => "14", 'maxlength' => "14", 'value' => h($dados['MEDICO']['CPF_MEDIC']), 'readonly'=>'readonly')); ?>
            </td>
            <td>
                <?php echo $this->Form->input('MEDICOS.NU_CNSUS', array('type' => 'text', 'label' => 'CNS', 'id' => 'txtCNS', 'class' => '', 'size' => "5", 'maxlength' => "5", 'value' => h($dados['MEDICO']['NU_CNSUS']), 'readonly'=>'readonly')); ?>
            </td>
        </tr>
        <tr>
            <td>
                <?php echo $this->Form->input('USUARIO.DS_EMAIL', array('type' => 'email', 'label' => 'Email principal', 'id' => 'txtEmailPrincipal', 'class' => 'campoEmail', 'size' => "50", 'maxlength' => "120", 'value' => h(substr($dados['AUTORIZADO']['DS_EMAIL'].' '.$dados['AUTORIZADO']['DS_EMAIL_SEC'], 0, 40).' ...') , 'readonly'=>'readonly' )); ?>
            </td>
            <td>
                <?php echo $this->Form->input('USUARIO.SEXO', array('type' => 'text', 'label' => 'Sexo', 'id' => 'txtSexo', 'value' => array_search($dados['AUTORIZADO']['SEXO'], array('Masculino' => 'M', 'Feminino' => 'F', 'Não Informado' => 'N')), 'readonly'=>'readonly'  )); ?>
            </td>            
            <td>
                <?php echo $this->Form->input('MEDICOS.ST_MRG', array('type' => 'text', 'label' => 'MRG?', 'value' => array_search($dados['MEDICO']['ST_MRG'], array('Sim' => 'S', 'Não' => 'N')), 'readonly'=>'readonly')); ?>
            </td>
        </tr>
        <tr>                 
            
        </tr>
    </table>
</fieldset>
<div id="dialogMedicos"></div>
<div id="divCadastroComplementar">

    <table width="98%" border="0" cellspacing="0" cellpadding="2">        
        <thead>
            <th colspan="3">
                <b>INFORMAÇÕES COMPLEMENTARES</b>
            </th>
            <th style="text-align: right;">
                <img src="/siscel/img/bt_lapis.gif" id="addComplementarMedico" onclick="Medico.dadosComplementaresMedico('<?php echo h($dados['MEDICO']['CPF_MEDIC']); ?>','<?php echo h($dados['MEDICO']['CD_CRM']); ?>',<?php echo h($dados['MEDICO']['UF_CRM']); ?>);"/>
            </th>
        </thead>
        <tbody>
            <tr>
                <td title="<?php echo h($dados[0]['TELEFONES']); ?>"><b>Telefones:</b> <?php echo substr(h($dados[0]['TELEFONES']), 0, 120).' ...'; ?></td>
            </tr>
        <tbody>
    </table>

    <!-- table width="98%" border="0" cellspacing="0" cellpadding="2">        
        <thead>
        <th colspan="3">
            <b>ESPECIALIDADES</b>
        </th>
        <th style="text-align: right;">
            <img src="/siscel/img/bt_lapis.gif" id="addEspecialidadeMedico" />
        </th>
        </thead>
        <tbody>
            <tr>
                <td colspan="3">Sem registros</td>
                <td></td>
            </tr>
        <tbody>
    </table -->

    <table width="98%" border="0" cellspacing="0" cellpadding="2">        
        <thead>
            <th colspan="3">
                <b>UNIDADES DE ATENDIMENTO</b>
            </th>
            <th style="text-align: right;">
                <!-- img src="/siscel/img/bt_lapis.gif" id="" / -->
            </th>
        </thead>
        <tbody>
            <?php if(!empty($arrInstLab)){
                foreach($arrInstLab as $in){ ?>
                    <tr>
                        <td>
                            <?php echo $this->Siscel->tipoServico($in['Servico']['TP_SERVICO']) .' - '. $in['Instituicaolab']['NM_INST'] ?>
                        </td>
                        <td style="text-align: right;">
                            <!-- img src="/siscel/img/bt_apagar.gif" id="" / -->
                        </td>
                    </tr>
            <?php
                }
            }else{ ?>
                <tr>
                    <td colspan="3">Sem registros</td>
                    <td></td>
                </tr>
            <?php } ?>
        <tbody>
    </table>

    <table width="98%" border="0" cellspacing="0" cellpadding="2">        
        <thead>
        <th colspan="3">
            <b>PACIENTES ATENDIDOS</b>
        </th>
        <th style="text-align: right;">
            <!-- img src="/siscel/img/bt_lapis.gif" id="" / -->
        </th>
        </thead>
        <tbody>
            <tr>
                <td colspan="3">Sem registros</td>
                <td></td>
            </tr>
        <tbody>
    </table>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        Medico.init();
    });
</script>